<?php echo $this->load->view('meta');?>
<link rel="stylesheet" href="<?=base_url();?>css/static.css" />
<title>Live Week - Fall, 2010</title>
<?php echo $this->load->view('header'); ?>
<?=$this->validation->error_string;?>

<script>
function dayChanged(selection) {
	

	var hoursel = document.getElementById("hoursel");
	
	if(selection == "Fri, Dec. 3") {
		hoursel.options.length = 9;

	} else {
		hoursel.options.length = 16;
		hoursel.options[9]=new Option("5-6pm", "5-6pm", false, false)
		hoursel.options[10]=new Option("6-7pm", "6-7pm", false, false)
		hoursel.options[11]=new Option("7-8pm", "7-8pm", false, false)
		hoursel.options[12]=new Option("8-9pm", "8-9pm", false, false)
		hoursel.options[13]=new Option("9-10pm", "9-10pm", false, false)
		hoursel.options[14]=new Option("10-11pm", "10-11pm", false, false)
		hoursel.options[15]=new Option("11-12am", "11-12am", false, false)
		
	}
}

function syncSelects(curVal) {
	var select = document.getElementById("hour");
	select.options[curVal].selected = true;
}

</script>

<h2>Live Week Sign Up</h2>
<?php 
$bigCount = 0;
for($h = 8; $h < 24; $h++) {
		echo("<tr>\n");
		$hour = $h;
		if($h > 12) {
			$hour = ($h-12) . ":00pm";
		} else if($h == 12) {
			$hour = $h . ":00pm";
		} else {
			$hour = $h . ":00am";
		}
		

		
		for($d = 0; $d<5; $d++) {
			echo("<td>\n");
			
			$day = $d;
			$month = 12;
			if($d < 2) {
				$day = 29 + $d;
				$month = 11;
			}
			
			//$result = get_timeslot($month, $day, $h);
			$start = "\"2010-" . $month . "-" . $day . " " . $h . ":00:00\""; 
			
			$result = $this->db->query("SELECT * FROM liveweek WHERE date = " . $start);
			
			$count = 0;
			
			foreach($result->result_array() as $row) {
				$count++;
				if($count <= 4) {
					$bigCount++;
				}
			}	
		}
	}
	?>
<div class="right_content_last">
<p>Please sign up for live week below.  We still have <?php echo(292-$bigCount); ?> slots open.  We're hoping to see at least 4 people praying each hour; please help us make this happen!  We will be praying 8am-Midnight Monday (Nov 29) through Thursday (Dec 2), and 8am-5pm on Friday (Dec 3) on the Brickyard at NC State's campus. The slots are all 1 hour each.  For more information about Live Week please see our group on  <a target="_blank" href="http://www.facebook.com/home.php#!/group.php?gid=106898519352423">facebook!</a>  </p>
<p>To view the current schedule, <a href="<?base_url();?>live_week_schedule"> click here</a> </p>
<p>Some useful guides: <br/>
	<a href="http://xa-ncsu.com/Live%20Week%20Prayer%20Guide.pdf">Prayer Guide</a> <br/>
	<a href="http://xa-ncsu.com/Live%20Week%20Prayer%20Tent%20Guidelines.pdf">Tent Guidelines</a> <br/>
</p>
<p>Note that Live Week is <i>endorsed</i> by Chi Alpha Christian Fellowship, but <b>not</b> a Chi Alpha event.  This just happens to be the webspace available at the moment :-)</p>

<p>Also, if you need to change your time, or cancel it altogether, please send me ("Alex Poulos") a message on facebook, or drop me an e-mail at mapoulos |AT| ncsu |DOT| edu.</p>
<?=form_open('xa/liveweek');?>
<fieldset>
	<legend>Information</legend>
	<ol class="twofifty">
		<li><label for="name">name</label>
			<input type="input" name="name" size="46" /></li>
		<li><label for="email">email</label>
			<input type="input" name="email" size="46" /></li>
		<li><label for="day">day</label>
			<select name="day" id="day" onchange="dayChanged(this.options[selectedIndex].text)">
				<option value="Nov. 29"> Mon, Nov. 29 </option>
				<option value="Nov. 30"> Tues, Nov. 20</option>
				<option value="Dec. 1"> Wed, Dec. 1 </option>
				<option value="Dec. 2"> Thurs, Dec. 2 </option>
				<option value="Dec. 3"> Fri, Dec. 3 </option>
			</select></li>
		<li><label for="hour">hour</label>
			<select id="hoursel" name="hour">
				<option value="8-9am"> 8-9am </option>
				<option value="9-10am"> 9-10am </option>
				<option value="10-11am"> 10-11am </option>
				<option value="11-12pm"> 11-12pm</option>
				<option value="12-1pm"> 12-1pm</option>
				<option value="1-2pm"> 1-2pm </option>
				<option value="2-3pm"> 2-3pm</option>
				<option value="3-4pm"> 3-4pm </option>
				<option value="4-5pm"> 4-5pm </option>
				<option value="5-6pm"> 5-6pm </option>
				<option value="6-7pm"> 6-7pm </option>
				<option value="7-8pm"> 7-8pm </option>
				<option value="8-9pm"> 8-9pm </option>
				<option value="9-10pm"> 9-10pm </option>
				<option value="10-11pm"> 10-11pm </option>
				<option value="11-12am"> 11-12am </option>
			</select></li>
		
		<li><?=form_submit('','submit');?></li>
	</ol>
</fieldset>
</form>

</div>
<?php //echo $this->load->view('footer');?>
